package com.mo.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.time.Duration;
import java.util.HashMap;
import java.util.Map;

/**
 * @author moon.pan
 * @program cyberdata
 * @apiNote
 * @since 2022/4/20
 */
@ConfigurationProperties("cache")
@Component
@Data
public class CacheProperties {

    @Value("${spring.application.name:}")
    private String prefix;

    /**
     * 全局配置过期时间, 8小时
     */
    private Duration entryTtl = Duration.ofHours(8);

    /**
     * cacheName 配置
     * eg:
     * datasource: PT3H
     */
    private Map<String, Duration> initialCache = new HashMap<>();
}
